home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
answrbok
/
6_15.lha
/
6_15
/
6_15h.h
next >
Wrap
Text File
|
1993-08-08
|
2KB
|
56 lines
* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
* The C++ Answer Book */
* Tony Hansen */
* All rights reserved. */
*
vector of four floats
Exercise 6.15
/
ifndef VEC4_H
define VEC4_H
include <stream.h>
verload gauss; // DELETE
include "6_15h1.h" // EXPAND class, vec4(), ~vec4()
// vec4 x(0.,0.,0.,0.);
vec4(float a, float b, float c, float d);
vec4(vec4& a); // vec4 x = y;
vec4(float a); // vec4 x = 35.;
vec4(int a); // vec4 x = 35;
vec4 operator=(vec4 a); // x = y;
vec4 operator=(float a); // x = 35.;
// x = a + b, a - b, a * b, a / b, +a, -a
friend vec4 operator+(vec4 a, vec4 b);
friend vec4 operator-(vec4 a, vec4 b);
friend vec4 operator*(vec4 a, vec4 b);
friend vec4 operator/(vec4 a, vec4 b);
friend vec4 operator+(vec4 a);
friend vec4 operator-(vec4 a);
vec4 operator+=(vec4 a); // x += a
vec4 operator-=(vec4 a); // x -= a
vec4 operator*=(vec4 a); // x *= a
vec4 operator/=(vec4 a); // x /= a
float& operator[](int i); // f = a[i]
// x = a == b, a != b
friend int operator==(vec4 a, vec4 b);
friend int operator!=(vec4 a, vec4 b);
// cout << a
friend ostream& operator<< (ostream& out, vec4 a);
float dot(vec4 a); // x = a.dot(b)
friend class mat4; // DELETE
friend vec4 operator*(mat4, vec4); // DELETE
friend vec4 operator*(vec4, mat4); // DELETE
friend int gauss(mat4& a, mat4& b); // DELETE
friend int gauss(mat4& a, vec4& b); // DELETE
;
endif /* VEC4_H */